package com.huangmb.anymark.server.service.impl;

import com.huangmb.anymark.server.dao.BaseDao;
import com.huangmb.anymark.server.dao.MarkerDao;
import com.huangmb.anymark.server.model.Category;
import com.huangmb.anymark.server.model.Marker;
import com.huangmb.anymark.server.service.MarkerService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户标记Service的实现类
 * @author hmb
 * @version 1.0
 * @since 2016/5/4 21:31
 */
@Service(value = "markerService")
@Transactional
public class MarkerServiceImpl extends BaseServiceImpl<Marker> implements MarkerService {
    @Resource(name = "markerDao")
    private MarkerDao mMarkerDao;
    @Resource(name = "markerDao")
    @Override
    public void setDao(BaseDao<Marker> dao) {
        super.setDao(dao);
    }
    public List<Marker> getByIds(Integer[] ids){
        return mMarkerDao.getByIds(ids);
    }

    @Override
    public List<Category> getAllCategory() {
        return mMarkerDao.getAllCategory();
    }

    @Override
    public List<Marker> getByUser(Integer id) {
        String hql = "from Marker where user.id = "+id;
        return mMarkerDao.findByHQL(hql);
    }
}
